import 'package:flutter_blog_manage_study/generated/json/base/json_convert_content.dart';
import 'package:flutter_blog_manage_study/model/language_entity.dart';

LanguageEntity $LanguageEntityFromJson(Map<String, dynamic> json) {
  final LanguageEntity languageEntity = LanguageEntity();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    languageEntity.name = name;
  }
  final String? language = jsonConvert.convert<String>(json['language']);
  if (language != null) {
    languageEntity.language = language;
  }
  final String? country = jsonConvert.convert<String>(json['country']);
  if (country != null) {
    languageEntity.country = country;
  }
  final bool? isSelect = jsonConvert.convert<bool>(json['isSelect']);
  if (isSelect != null) {
    languageEntity.isSelect = isSelect;
  }
  return languageEntity;
}

Map<String, dynamic> $LanguageEntityToJson(LanguageEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['language'] = entity.language;
  data['country'] = entity.country;
  data['isSelect'] = entity.isSelect;
  return data;
}

extension LanguageEntityExtension on LanguageEntity {
  LanguageEntity copyWith({
    String? name,
    String? language,
    String? country,
    bool? isSelect,
  }) {
    return LanguageEntity()
      ..name = name ?? this.name
      ..language = language ?? this.language
      ..country = country ?? this.country
      ..isSelect = isSelect ?? this.isSelect;
  }
}